package ca.ericslandry.shared.event;

import ca.ericslandry.shared.domain.User;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class LoginEvent extends GwtEvent<LoginEvent.Handler> {
	public interface Handler extends EventHandler {
		public void onLogin(LoginEvent event);
	}

	public static Type<LoginEvent.Handler> TYPE = new Type<LoginEvent.Handler>();
	private User user;

	public LoginEvent(User user) {
		this.user = user;
	}

	@Override
	protected void dispatch(LoginEvent.Handler handler) {
		handler.onLogin(this);
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<LoginEvent.Handler> getAssociatedType() {
		return TYPE;
	}

	public User getUser() {
		return user;
	}

}
